home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / tools / pprd100 / pprd.h < prev    next >
C/C++ Source or Header  |  1996-07-10  |  2KB  |  81 lines

  1. #define    LPDPORT    515        /* TCP */
  2.  
  3. #define    LOGPORT    514        /* UDP */
  4.  
  5. #define    LOG_TAG    "<54>"        /* LOG_LPR + LOG_INFO */
  6.  
  7. #define    JDPORT    9100        /* direct to printer */
  8.  
  9. enum connstate
  10. {
  11.     INIT,
  12.     WAITING,
  13.     QUEUENAME,
  14.     RECVJOB,
  15.     CONTROLINFO,
  16.     CONTROL,
  17.     DATAINFO,
  18.     DATA,
  19.     PRINTING,
  20.     NAKANDCLOSE,
  21.     CLOSING,
  22.     ABORT
  23. };
  24.  
  25. struct conn_info
  26. {
  27.     enum connstate    state;            /* of a connection */
  28.     int        controlfirst;        /* control data first? */
  29.     int        printer;        /* 0 to 2 */
  30.     tcp_Socket    sock;            /* connection */
  31.     long        bytelen;        /* of current file */
  32.     char        buffer[2048];        /* for data */
  33.     char        *bufip;            /* input point */
  34.     char        *bufop;            /* output point */
  35.     char        jobname[32];
  36.     char        username[32];
  37.     char        hostname[32];
  38.     time_t        starttime;
  39.     long        joblen;
  40. };
  41.  
  42. #define    reset_ptrs(c)    (c)->bufip = (c)->bufop = (c)->buffer
  43. #define    data_unseen(c)    ((c)->bufip > (c)->buffer)
  44. #define    data_remaining(c)    ((c)->bufip != (c)->bufop)
  45. #define    buffer_room(c)    ((c)->buffer + sizeof((c)->buffer) - (c)->bufip)
  46.  
  47. enum pstate
  48. {
  49.     NONESUCH = 0,
  50.     DISABLED,
  51.     FREE,
  52.     BUSY,
  53. };
  54.  
  55. struct lpt_info
  56. {
  57.     enum pstate    avail;            /* active? */
  58.     int        status;            /* from last biosprint */
  59.     int        hwaddr;            /* port address, != 0 == use */
  60. };
  61.  
  62. #define    bios_printer_init(i)    biosprint(1,0,i)
  63. #define    bios_printer_status(i)    biosprint(2,0,i)
  64. #define    bios_printer_outch(i,c)    biosprint(0,c,i)
  65.  
  66. /* printer status bits */
  67. #define    P_TIMEOUT    0x01
  68. #define    P_IOERROR    0x08
  69. #define    P_SELECTED    0x10
  70. #define    P_NOPAPER    0x20
  71. #define    P_ACK        0x40
  72. #define    P_IDLE        0x80
  73.  
  74. #define    P_CHANGES    (P_TIMEOUT|P_IOERROR|P_SELECTED|P_NOPAPER)
  75. #define    P_READY        (P_SELECTED|P_IDLE)
  76.  
  77. /* key definitions */
  78. #define    CF1    0x5e                /* CTRL-F1 */
  79. #define    CF2    0x5f
  80. #define    CF3    0x60
  81.